package oop.inherit.autoCar;

//继承Auto，并添加空调、CD等成员变量，覆盖加速，减速的方法
public class Car extends Auto{

    boolean airCondition;
    boolean CD;

    public Car(int tyreCount, String color, double weight, int speed,boolean airCondition,boolean CD) {
        super(tyreCount, color, weight, speed);
        this.airCondition = airCondition;
        this.CD = CD;
    }

    @Override
    public void addSpeed(int speed) {
        this.speed += (speed+20);
    }

    @Override
    public void subSpeed(int speed) {
        this.speed -= (speed+20);
        if(this.speed<0){
            this.speed = 0;
        }
    }
}
